package com.example.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.domain.DishFlavor;
import com.example.dto.DishDto;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DishFlavorDao extends BaseMapper<DishFlavor> {
    @Insert("insert into dish_flavor values (#{id},#{dishId},#{name},#{value},#{createTime},#{updateTime},#{createUser},#{updateUser},0)")
    public void save(DishFlavor dishFlavor);
    @Select("select * from dish_flavor where dish_id=#{dishId}")
    public List<DishFlavor> selectbydishid(Long dishId);

    @Update("update dish_flavor set value=#{value},update_time=#{updateTime},update_user=#{updateUser} where dish_id=#{dishId} and name=#{name}")
    public void update(DishFlavor dishFlavor);

    @Select("select name from dish_flavor where dish_id=#{dishId}")
    public List<String> getnamebydishid(Long dishId);

    @Delete("delete from dish_flavor where name like #{name} and dish_id=#{dishId}")
    public void deletebynameanddishid(String name,Long dishId);
}
